<template>
    <div>
        <Row style="line-height: 35px;">
            <Col span='2'>
                <b>基础信息</b>
            </Col>
            <Col span='9' offset="1">
                <span>单位名称：{{InputData.enRiskInfo.riskUnit}}</span>
            </Col>
            <Col span='9' offset="1">
                <span>车间/部门：{{InputData.enRiskInfo.riskUnit2}}</span>
            </Col>
        </Row>
        <Row style="line-height: 35px" class="detail-background-clor">
            <Col span='9' offset="3">
                <span>发生部位：{{InputData.enRiskInfo.riskUnit3}}</span>
            </Col>
            <Col span='9' offset="1">
                <span>风险源/危险物质：{{InputData.enRiskInfo.riskSources}}</span>
            </Col>
        </Row>
        <Row style="line-height: 35px">
            <Col span='9' offset="3">
                <span>环境危害和途径：{{InputData.enRiskInfo.environmentalHazards}}</span>
            </Col>
            <Col span='9' offset="1">
                <span>可能发生事故事件类型：{{InputData.enRiskInfo.eventType}}</span>
            </Col>
        </Row>
        <hr style="margin-top: 10px;color: #dcdcdc"/>
        <div v-if="!ifAssess">
            <Row style="line-height: 35px;margin-top: 10px">
                <Col span='2'>
                    <b>风险评价</b>
                </Col>
                <Col span='6' offset="1">
                    <span>历史发生违法事件频次Q1：{{InputData.q1}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>防控措施水平Q2：{{InputData.q2}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>投诉举报Q3：{{InputData.q3}}</span>
                </Col>
            </Row>
            <Row style="line-height: 35px" class="detail-background-clor">
                <Col span='6' offset="3">
                    <span>污染物排放浓度/标准值（M1）：{{InputData.m1}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>危险物质泄漏数量/临界值（M2）：{{InputData.m2}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>经济严重性等级E：{{InputData.e1}}</span>
                </Col>
            </Row>
            <Row style="line-height: 35px">
                <Col span='6' offset="3">
                    <span>环境影响受体严重性等级S11a：{{InputData.s11a}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>环境影响受体严重性等级S11b：{{InputData.s11b}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>社会关注度严重性等级（S12）：{{InputData.s12}}</span>
                </Col>
            </Row>
            <Row style="line-height: 35px" class="detail-background-clor">
                <Col span='6' offset="3">
                    <span>发生可能性：{{InputData.passibleCal}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>后果严重性分析：{{InputData.severityCal}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>风险等级：
                        <span v-if="InputData.rikColor=='红'" style="color: red">{{InputData.rikRankName}}</span>
                        <span v-else-if="InputData.rikColor=='橙'"
                                style="color: orange">{{InputData.rikRankName}}</span>
                        <span v-else-if="InputData.rikColor=='黄'"
                                style="color: #FDD835">{{InputData.rikRankName}}</span>
                        <span v-else-if="InputData.rikColor=='蓝'" style="color: blue">{{InputData.rikRankName}}</span>
                        <span v-else style="color: white">{{InputData.rikRankName}}</span>
                    </span>
                </Col>
            </Row>
            <hr style="margin-top: 10px;color: #dcdcdc"/>
            <Row style="line-height: 35px;margin-top: 10px">
                <Col span='2'>
                    <b>风险管控</b>
                </Col>
                <Col span='21' offset="1">
                    <span>风险防范措施：{{InputData.enRiskManage.manageMeasure}}</span>
                </Col>
            </Row>
          <Row style="line-height: 35px" class="detail-background-clor">
            <Col span='9' offset="3">
              <span>责任部门：{{ InputData.enRiskManage.dutyOrgName }}</span>
            </Col>
            <Col span='9' offset="1">
              <span>责任人：{{ InputData.enRiskManage.dutyPersonName }}</span>
            </Col>
          </Row>
          <Row style="line-height: 35px" class="detail-background-clor">
            <Col span='9' offset="3">
              <span>录入人：{{ InputData.enRiskManage.recorder }}</span>
            </Col>
            <Col span='9' offset="1">
              <span>录入时间：{{ InputData.enRiskManage.recordeTime }}</span>
            </Col>
          </Row>
        </div>
        <div v-else>
            <Row style="line-height: 25px;margin-top: 10px">
                <Col span='2'>
                    <b>风险评价</b>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='历史发生违法事件频次Q1：' prop="q1">
                        <Select v-model="InputData.q1">
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.q1Name }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='防控措施水平Q2：' prop="q2">
                        <Select v-model="InputData.q2">
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.q2Name }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='投诉举报Q3：' prop="q3">
                        <Select v-model="InputData.q3">
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.q3Name }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="3">
                    <FormItem label='污染物排放浓度/标准值（M1）：' prop="m1">
                        <Select v-model="InputData.m1">
                            <Option value="0" label="0">
                                <span>0</span>
                                <span style="float:right;color:#ccc">不涉及</span>
                            </Option>
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.m1Name }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='危险物质泄漏数量/临界值（M2）：' prop="m2">
                        <Select v-model="InputData.m2">
                            <Option value="0" label="0">
                                <span>0</span>
                                <span style="float:right;color:#ccc">不涉及</span>
                            </Option>
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.m2Name }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='经济严重性等级E：' prop="e1">
                        <Select v-model="InputData.e1">
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.e1Name }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="3">
                    <FormItem label='环境影响受体严重性等级S11a：' prop="s11a">
                        <Select v-model="InputData.s11a">
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.s11aName }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='环境影响受体严重性等级S11b：' prop="s11b">
                        <Select v-model="InputData.s11b">
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.s11bName }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='社会关注度严重性等级（S12）：' prop="s12">
                        <Select v-model="InputData.s12">
                            <Option v-for="item in q1List" :value="item.id" :label="item.id">
                                <span> {{item.id}}</span>
                                <span style="float:right;color:#ccc"> {{item.s12Name }}</span>
                            </Option>
                        </Select>
                    </FormItem>
                </Col>
            </Row>
            <Row style="line-height: 25px;margin-top: 10px">
                <Col span='6' offset="3">
                    <span>发生可能性：{{passibleCal}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>后果严重性分析：{{InputData.severityCal}}</span>
                </Col>
                <Col span='6' offset="1">
                    <span>风险等级：
                        <span v-if="InputData.rikColor=='红'" style="color: red">{{InputData.rikRankName}}</span>
                        <span v-else-if="InputData.rikColor=='橙'"
                                style="color: orange">{{InputData.rikRankName}}</span>
                        <span v-else-if="InputData.rikColor=='黄'"
                                style="color: #FDD835">{{InputData.rikRankName}}</span>
                        <span v-else-if="InputData.rikColor=='蓝'" style="color: blue">{{InputData.rikRankName}}</span>
                        <span v-else style="color: white">{{InputData.rikRankName}}</span>
                    </span>
                </Col>
            </Row>
            <hr style="margin-top: 10px;color: #dc234b"/>
            <Row style="line-height: 25px;margin-top: 10px">
                <Col span='2'>
                    <b>风险管控</b>
                </Col>
                <Col span='20' offset="1">
                    <FormItem label='风险防范措施：' prop="manageMeasure">
                        <Input v-model="InputData.enRiskManage.manageMeasure" type="textarea" :autosize="{minRows:2,maxRows:5}"/>
                    </FormItem>
                </Col>
                <Col span='6' offset="3">
                    <FormItem label='责任部门：' prop="dutyOrgId"><!-- dutyOrgId -->
                        {{InputData.enRiskManage.dutyOrgName}}
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='责任人：' prop="dutyPersonId"><!--dutyPersonId-->
                        {{InputData.enRiskManage.dutyPersonName}}
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                </Col>
            </Row>
            <Row style="line-height: 25px;margin-top: 10px">
                <Col span='6' offset="3">
                    <FormItem label='录入人：'>
                        {{InputData.enRiskManage.recorder}}
                    </FormItem>
                </Col>
                <Col span='6' offset="1">
                    <FormItem label='录入时间：'>
                        {{InputData.enRiskManage.recordeTime}}
                    </FormItem>
                </Col>
            </Row>
        </div>
    </div>
</template>

<script>
    import cascaderDom from '../../../components/cascader-dom.vue';
    export default {
        components: {cascaderDom},
        name: "environmentalRiskApprovalDetail",
        props: ['InputData','model1','ifAssess'],
        data() {
            return {
                q1List: [
                    {
                        id: 1,
                        q1Name: '过去从未发生',
                        q2Name: '防控措施完全满足各方污染防控要求',
                        q3Name: '过去从未发生',
                        m1Name: '<0.3排放标准',
                        m2Name: 'R<1',
                        e1Name: '≤10',
                        s11aName: '≤99',
                        s11bName: '＞1000',
                        s12Name: '社区乡镇',
                    },
                    {
                        id: 2,
                        q1Name: '近4年内发生一次及以上',
                        q2Name: '防控措施完全满足地方污染防控要求',
                        q3Name: '年内一次举报经查不属实',
                        m1Name: '<0.5排放标准',
                        m2Name: 'R=1',
                        e1Name: '11～99',
                        s11aName: '100～199',
                        s11bName: '1000～800',
                        s12Name: '县市'
                    },
                    {
                        id: 3,
                        q1Name: '近3年内发生一次及以上',
                        q2Name: '防控措施基本满足各方污染防控要求',
                        q3Name: '年内多次举报经查不属实',
                        m1Name: '<0.75排放标准',
                        m2Name: '1≤R<10',
                        e1Name: '100～499',
                        s11aName: '200～499',
                        s11bName: '799～500',
                        s12Name: '省市'
                    },
                    {
                        id: 4,
                        q1Name: '近2年内发生一次及以上',
                        q2Name: '防控措施不能完全满足各方污染防控要求',
                        q3Name: '举报并被查实的',
                        m1Name: '≤1排放标准',
                        m2Name: '10≤R<100',
                        e1Name: '500～999',
                        s11aName: '500～999',
                        s11bName: '499～200',
                        s12Name: '国内'
                    },
                    {
                        id: 5,
                        q1Name: '近1年内发生一次及以上',
                        q2Name: '防控措施不到位或没有防控措施',
                        q3Name: '多次举报并被查实的',
                        m1Name: '>1排放标准',
                        m2Name: '100≤R',
                        e1Name: '1000以上',
                        s11aName: '1000以上',
                        s11bName: '＜199',
                        s12Name: '国外'
                    }
                ]
            }
        },
        computed: {
            passibleCal: function () {
                let r5 = 0 //可能性计算
                let s5 = 0 //严重性计算
                let rikRan = ' '
                let rikColor = ' '
                if (this.InputData.q1 > 0 && this.InputData.q2 > 0 && this.InputData.q3 > 0) {
                    r5 = Math.ceil(this.NumberAdd(this.InputData.q3,this.NumberAdd(this.InputData.q1, this.InputData.q2)) / 3)
                }
                if (this.InputData.m1 > 0 && this.InputData.m2 > 0 && this.InputData.e1 > 0 && this.InputData.s11a > 0 && this.InputData.s11b > 0&& this.InputData.s12 > 0) {
                    s5 = Math.ceil((this.InputData.m1 + this.InputData.m2 + this.InputData.e1 + this.InputData.s11a + this.InputData.s11b+ this.InputData.s12) / 6)
                }
                if (this.InputData.m1 == 0 && this.InputData.m2 > 0 && this.InputData.e1 > 0 && this.InputData.s11a > 0 && this.InputData.s11b > 0&& this.InputData.s12 > 0) {
                    s5 = Math.ceil((this.InputData.m1 + this.InputData.m2 + this.InputData.e1 + this.InputData.s11a + this.InputData.s11b+ this.InputData.s12) / 5)
                }
                if (this.InputData.m1 > 0 && this.InputData.m2 == 0 && this.InputData.e1 > 0 && this.InputData.s11a > 0 && this.InputData.s11b > 0&& this.InputData.s12 > 0) {
                    s5 = Math.ceil((this.InputData.m1 + this.InputData.m2 + this.InputData.e1 + this.InputData.s11a + this.InputData.s11b+ this.InputData.s12) / 5)
                }
                if (this.InputData.m1 == 0 && this.InputData.m2 == 0 && this.InputData.e1 > 0 && this.InputData.s11a > 0 && this.InputData.s11b > 0&& this.InputData.s12 > 0) {
                    s5 = Math.ceil((this.InputData.m1 + this.InputData.m2 + this.InputData.e1 + this.InputData.s11a + this.InputData.s11b+ this.InputData.s12) / 4)
                }
               this.InputData.passibleCal = r5 > 0 ? r5 : ' ';
                // this.InputData.passibleVal = r5 > 0 ? r5 : ' ';
/*              if (s5 == 0 || r5 == 0) {
                    rikRan = ' '
                } else if ((r5 > 2 && s5 == 5) || (r5 == 5 && s5 == 4)) {
                    rikRan = '重大'
                } else if ((r5 == 2 && s5 == 5) || ((r5 == 3 || r5 == 4) && s5 == 4) || (r5 > 3 && s5 == 3) || (s5 == 2 && r5 == 5)) {
                    rikRan = '较大'
                } else if ((r5 == 1 && s5 > 3) || ((s5 == 3 || s5 == 4) && r5 == 2) || ((s5 == 2 || s5 == 3) && r5 == 3) || (s5 == 2 && r5 == 4) || (s5 == 1 && r5 > 3)) {
                    rikRan = '一般'
                } else {
                    rikRan = '低'
                }
                rikColor = rikRan == '重大' ? '红' : rikRan == '较大' ? '橙' : rikRan == '一般' ? '黄' : rikRan == '低' ? '蓝' : ' '
                this.InputData.rikRankName = rikRan;
                this.InputData.rikColor = rikColor
                this.InputData.enRiskAssess.rikColor = rikColor */
                return this.InputData.passibleCal;
            },
        },
        methods:{
        },
    }
</script>

<style scoped>

</style>
